package com.lostandfound.controller;

import com.lostandfound.pojo.FindAny;
import com.lostandfound.pojo.Result;
import com.lostandfound.pojo.dto.Everything;
import com.lostandfound.service.EveryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/everything")
public class EveryController {

    @Autowired
    private EveryService everyService;

    /**
     * 根据id查询物品信息
     * @param everything
     * @return
     */
    @PostMapping
    public Result findById(@RequestBody Everything everything) {
        Object object = everyService.findById(everything);
        if (object==null){
            return  Result.error("信息有误");
        }
        return Result.success(object);
    }

}
